package com.trafficsys.modules.owner.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.trafficsys.modules.entity.TravelCard;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface EditCarDao extends BaseMapper<TravelCard> {
    @Delete("delete  from travel_card where travel_car_id =#{travelCarId}")
    int delCarByTravelCarId(@Param("travelCarId") String travelCarId);

    @Insert("insert into travel_card (vin,brand_model,car_clazz,car_no,engine_no,file_no,invalid_date,state,travel_car_id,user_nature) " +
            "values (#{vin}, #{brandModel}, #{carClazz}, #{carNo}, #{engineNo}, #{fileNo}, #{invalidDate}, #{state}, #{travelCarId}, #{userNature}) ")
    int addCarByTravelCarId(TravelCard travelCard);

    @Update("update travel_card set travel_car_id=#{travelCarId} where car_no=#{carNo}  ")
    int updateCarByTravelCarId(TravelCard travelCard);
}
